package cn.jeefast.rest.controller;


import cn.jeefast.common.utils.R;
import cn.jeefast.rest.annotation.AuthIgnore;
import cn.jeefast.rest.service.MbCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author theodo
 * @since 2019-12-30
 */
@RestController
@RequestMapping("/api")
public class MbCodeController {

    @Autowired
    private MbCodeService codeService;

    /**
     * 获取验证码
     * @param phone
     * @return
     */
    @RequestMapping("/code/getCode")
    @AuthIgnore
    @CrossOrigin
    public R getCode(String phone){
        return codeService.getCode(phone);
    }

    /**
     * 验证验证码是否正确
     * @param phone
     * @param code
     * @return
     */
    @RequestMapping("/code/checkCode")
    @AuthIgnore
    @CrossOrigin
    public R checkCode(String phone,String code){
        return codeService.checkCode(phone,code);
    }
}
